import type {
  OrderPre,
  AddressItem,
  OrderDetail,
  Logistics
} from '@/types/order'
import { request } from '@/utils/request'

// 获取药品订单预支付信息
export const getMedicineOrderPreAPI = (prescriptionId: string) => {
  return request<OrderPre>('/patient/medicine/order/pre', 'GET', {
    prescriptionId
  })
}

// 获取收货地址详情
export const getAddressListAPI = () => {
  return request<AddressItem[]>('/patient/order/address')
}

// 获取药品订单ID
export const getMedicineOrderIdAPI = (data: {
  id: string
  couponId?: string
  addressId: string
}) => {
  return request<{ id: string }>('/patient/medicine/order', 'POST', data)
}

// 获取药品订单详情
export const getMedicalOrderDetailAPI = (id: string) => {
  return request<OrderDetail>(`/patient/medicine/order/detail/${id}`)
}

// 获取物流信息接口
export const getLogisticsAPI = (id: string) => {
  return request<Logistics>(`/patient/order/${id}/logistics`)
}
